Thread: USE of char \377

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    11

    Exclamation USE of char \377

    I have seen this char at many places in the code base , Its something to deal with signed and unsigned char ?
    Can some plese tell what is this exactly used for

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What code-base is that. I haven't found it particularly often in my 20+ years as a programmer. It is the same as 0xFF (or -1 in signed chars). It is, as far as I know, an "unprintable" character in ANSI 8-bit character sets, so it may be used for special purposes by some people since it's unlikely to appear in texts - particularly where you can't use NUL (another unprintable character) since it's the "end of string marker". But that's speculatin. Perhpas I would be able to give a better answer if you point us to the code?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    11

    Unhappy

    Quote Originally Posted by matsp View Post
    What code-base is that. I haven't found it particularly often in my 20+ years as a programmer. It is the same as 0xFF (or -1 in signed chars). It is, as far as I know, an "unprintable" character in ANSI 8-bit character sets, so it may be used for special purposes by some people since it's unlikely to appear in texts - particularly where you can't use NUL (another unprintable character) since it's the "end of string marker". But that's speculatin. Perhpas I would be able to give a better answer if you point us to the code?

    --
    Mats
    It is being used at the starting of a string , and with this we are trying to set a PDL variable [Printer Descriptor Language].
    Can we use this char to set a XML string variable also ??

  4. #4
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    code snippet

    AddData("@PJL SET JOBATTR=\"JobAcct7=\377Internal Page\"\r\n");

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by manohar.amit View Post
    It is being used at the starting of a string , and with this we are trying to set a PDL variable [Printer Descriptor Language].
    Can we use this char to set a XML string variable also ??
    In this case, it's probably some "special meaning to the PDL", but again, this is a guess - it's not an area I'm particularly familiar with - it could simply be to "make sure this lists last in an alphabetical sort - as 0377 is the highest "ascii" code you could come up with.

    I expect you can use this in XML - I don't see why not.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    i was going through google looking at varios code snippets , and in all these this char was use to do some signed unsigned operations .

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by manohar.amit View Post
    i was going through google looking at varios code snippets , and in all these this char was use to do some signed unsigned operations .
    Not sure what you mean by "signed unsigned operations" - yes, it's -1 if you treat it as signed.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,339
    \377 is octal for:
    • 255 decimal
    • FF hexadecimal
    • 1111 1111 binary

    It is unprintable and is most likely being used as a control character of some sort.

    Todd

  9. #9
    Registered User
    Join Date
    Nov 2007
    Posts
    11

    Unhappy Query

    Thanxs a lot everyone ,1 more question ,
    If i have a nonnegativeinteger in XML Schema , and i try to set it with a negative integer , will the system crash ??

  10. #10
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by manohar.amit View Post
    code snippet

    AddData("@PJL SET JOBATTR=\"JobAcct7=\377Internal Page\"\r\n");
    Are you asking what \377 actually means, or are you asking whether a code of \377 is valid when occurring inside a PJL environment attribute? As far as C is concerned, there is nothing special about the value \377. I have no idea what restrictions XML may have. But as far as PJL, this is valid PJL.

    BTW, this is the first time somebody has ever asked a question that relates to my day job

  11. #11
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Quote Originally Posted by brewbuck View Post
    BTW, this is the first time somebody has ever asked a question that relates to my day job
    You have a job that involves using ridiculously high ASCII chars?

  12. #12
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by MacGyver View Post
    You have a job that involves using ridiculously high ASCII chars?
    My day job is among other things to be ridiculously well-versed in PJL, PCL, and HPGL/2 printer languages.

  13. #13
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by manohar.amit View Post
    Thanxs a lot everyone ,1 more question ,
    If i have a nonnegativeinteger in XML Schema , and i try to set it with a negative integer , will the system crash ??
    Probably not, but you will possibly get an error attempting to read the data back in, or it will do "unpredictable" things [such as not treating the number as a negative, but as a very large positive number].

    It should be fairly easy to hack up a quick test to figure out...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Sorting Linked Lists
    By DKING89 in forum C Programming
    Replies: 6
    Last Post: 04-09-2008, 07:36 AM
  3. code condensing
    By bcianfrocca in forum C++ Programming
    Replies: 4
    Last Post: 09-07-2005, 09:22 AM
  4. Passing structures... I can't get it right.
    By j0hnb in forum C Programming
    Replies: 6
    Last Post: 01-26-2003, 11:55 AM
  5. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 01:18 AM